package 线程.常用的成员方法;

public class 优先级 {
    public static void main(String[] args) {
        //1.创建线程的任务对象
        MyRun mr=new MyRun();

        //2.创建线程的对象
        Thread t1=new Thread(mr,"大王");
        Thread t2 = new Thread(mr, "小王");

        //3.获取当前线程的优先级
        int priority = t1.getPriority();
        int priority1 = t2.getPriority();
        //4.设置线程的优先级
        t1.setPriority(10);
        t2.setPriority(1);

        //5.开启线程
        t1.start();
        t2.start();

    }
}
